public class num876 {
    public ListNode middleNode(ListNode head) {
        if(head == null || head.next == null){
            return head;
        }
        ListNode fast = head;
        ListNode snow = head;
        while (fast != null && fast.next != null){
            fast = fast.next.next;
            snow = snow.next;
        }
        return snow;
    }
}
